package com.sfzd5.exam.helplibrary.exam;

public class PageA4 {
    public static final float in2mm = 25.4f;
    public static final float pageWidthm = 210f;
    public static final float pageHeightm = 297f;
    public static int dpi = 72;

    public static float blankSP = 2.5f;

    public static float pageInfoHightm = 25f;

    // 行线宽度
    public static float lineWidthm = 0.2f;
    // 边框线宽度
    public static float boardWidthm = 0.4f;

    public static float optionLineHeightm = 5f; //每行选项高是5mm，字号是3mm

    public static int marginLeftRightm = 15;
    public static int marginTopBottom = 20;

    public static float areaMarginm = 2;

    public static float contextWidthm(){
        return pageWidthm - 2* marginLeftRightm;
    }

    public static float contextHeightm(){
        return pageHeightm - 2* marginTopBottom;
    }

    public static float lineHightm = 10;

    public static float mm2point(float mm){
        return dpi*mm/in2mm;
    }

    public static float point2mm(float width) {
        return width * in2mm / dpi;
    }

    public static boolean isInPage(float ym){
        return ym < pageHeightm - marginTopBottom;
    }

    //A4纸的尺寸
    public static int getPageWidth(){ return (int)mm2point(pageWidthm);} // = 2480;
    public static int getPageHeight(){return (int)mm2point(pageHeightm);} // = 3508;

    public static float lineWidth(){
        return mm2point(lineWidthm);
    }

    public static float boardWidth(){
        return mm2point(boardWidthm);
    }

    public static float contextWidth(){
        return mm2point(contextWidthm());
    }

    public static float contextHeight(){
        return mm2point(contextHeightm());
    }

    public static float lineHight(){
        return mm2point(lineHightm);
    }
}
